package windows;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JSpinner;
import javax.swing.JTextArea;

public class ManageInsumosModify extends JPanel implements ActionListener
{

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private JButton Modify;
	private JButton save;
	private JButton search;
	
	private JLabel TextNameInsumo;
	private JLabel TextCodInsumo;
	private JLabel TextEgg;
	private JLabel TextFlour;
	private JLabel TextSugar;
	private JLabel TextMilk;
	private JLabel TextColoring;
	private JLabel TextSabor;
	private JLabel TextStraberry;
	private JLabel TextRaisin;

	private JTextArea AreaNameInsumo;
	private JTextArea AreaCodInsumo;
	
	private JRadioButton RButtonEgg;
	private JRadioButton RButtonFlour;
	private JRadioButton RButtonSugar;
	private JRadioButton RButtonMilk;
	private JRadioButton RButtonColoring;
	private JRadioButton RButtonSabor;
	private JRadioButton RButtonStraberry;
	private JRadioButton RButtonRaisin;

	private JSpinner JSPEgg;
	private JSpinner JSPFlour;
	private JSpinner JSPSugar;
	private JSpinner JSPMilk;
	private JSpinner JSPColoring;
	private JSpinner JSPSabor;
	private JSpinner JSPstraberry;
	private JSpinner JSPRaisin;


	
	public ManageInsumosModify()
	{
		// TODO Auto-generated constructor stub

	
	
	setLayout(null);


	RButtonFlour=new JRadioButton();
	RButtonFlour.setBounds(230,85, 30, 20);
	RButtonFlour.setEnabled(false);
	RButtonFlour.addActionListener(this);
	add(RButtonFlour);
	
	RButtonSugar=new JRadioButton();
	RButtonSugar.setBounds(230,120, 30, 20);
	RButtonSugar.setEnabled(false);
	RButtonSugar.addActionListener(this);
	add(RButtonSugar);

	RButtonEgg=new JRadioButton();
	RButtonEgg.setBounds(230,155, 30, 20);
	RButtonEgg.setEnabled(false);
	RButtonEgg.addActionListener(this);
	add(RButtonEgg);

	RButtonSabor=new JRadioButton();
	RButtonSabor.setBounds(230,190, 30, 20);
	RButtonSabor.setEnabled(false);
	RButtonSabor.addActionListener(this);
	add(RButtonSabor);

	RButtonMilk=new JRadioButton();
	RButtonMilk.setBounds(230,225, 30, 20);
	RButtonMilk.setEnabled(false);
	RButtonMilk.addActionListener(this);
	add(RButtonMilk);
	
	RButtonColoring=new JRadioButton();
	RButtonColoring.setEnabled(false);
	RButtonColoring.setBounds(230,260, 30, 20);
	RButtonColoring.addActionListener(this);
	add(RButtonColoring);
			
	RButtonStraberry=new JRadioButton();
	RButtonStraberry.setBounds(230,295, 30, 20);
	RButtonStraberry.setEnabled(false);
	RButtonStraberry.addActionListener(this);
	add(RButtonStraberry);
	
	RButtonRaisin=new JRadioButton();

	RButtonRaisin.setEnabled(false);
	RButtonRaisin.setBounds(230,330, 30, 20);
	RButtonRaisin.addActionListener(this);
	add(RButtonRaisin);
	
	
	
	

	/*********************************JSpinner***********************************************/


	JSPFlour=new JSpinner();
	JSPFlour.setBounds(300, 85, 40, 25);
	JSPFlour.setEnabled(false);
	add(JSPFlour);

	JSPSugar=new JSpinner();
	JSPSugar.setBounds(300, 120, 40, 25);
	JSPSugar.setEnabled(false);
	add(JSPSugar);

	JSPEgg=new JSpinner();
	JSPEgg.setBounds(300, 155, 40, 25);
	JSPEgg.setEnabled(false);
	add(JSPEgg);

	JSPSabor=new JSpinner();
	JSPSabor.setBounds(300,190, 40, 25);
	JSPSabor.setEnabled(false);
	add(JSPSabor);
	
	JSPMilk=new JSpinner();
	JSPMilk.setBounds(300, 225, 40, 25);
	JSPMilk.setEnabled(false);
	add(JSPMilk);

	JSPColoring=new JSpinner();
	JSPColoring.setBounds(300, 260, 40, 25);
	JSPColoring.setEnabled(false);
	add(JSPColoring);

	
	JSPstraberry=new JSpinner();
	JSPstraberry.setBounds(300, 295, 40, 25);
	JSPstraberry.setEnabled(false);
	add(JSPstraberry);

	JSPRaisin=new JSpinner();
	JSPRaisin.setBounds(300, 330, 40, 25);
	JSPRaisin.setEnabled(false);
	add(JSPRaisin);


	
	/***************************JButton**************************************/
	Modify = new JButton("Modificar");
	Modify.setBounds(100,400, 100, 20);
	Modify.setVisible(false);
	Modify.addActionListener(this);
	add(Modify);

	search= new JButton("Buscar");
	search.setBounds(370,15, 80, 20);
	search.addActionListener(this);
	add(search);

	save= new JButton("Guardar");
	save.setBounds(250,400, 100, 20);
	save.setVisible(false);
	save.addActionListener(this);
	add(save);
    /******************************JLabel**********************************/

	TextCodInsumo=new JLabel("Codigo:");
	TextCodInsumo.setBounds(50, 15, 150, 25);
	add(TextCodInsumo);		
	
	TextNameInsumo = new JLabel("Nombre Lista:");
	TextNameInsumo.setBounds(50, 50, 150, 25);
	add(TextNameInsumo);

	TextFlour = new JLabel("Harina:");
	TextFlour.setBounds(50, 85, 150, 25);
	add(TextFlour);

	TextSugar = new JLabel("Azucar:");
	TextSugar.setBounds(50, 120, 150, 25);
	add(TextSugar);

	TextEgg=new JLabel("Huevos");
	TextEgg.setBounds(50, 155, 150, 25);
	add(TextEgg);
	
	TextSabor=new JLabel("Saborizantes");
	TextSabor.setBounds(50, 190, 150, 25);
	add(TextSabor);
	
	TextMilk=new JLabel("Leche:");
	TextMilk.setBounds(50, 225, 150, 25);
	add(TextMilk);

	TextColoring=new JLabel("Colorantes:");
	TextColoring.setBounds(50, 260, 150, 25);
	add(TextColoring);

	TextStraberry=new JLabel("Fresas:");
	TextStraberry.setBounds(50, 295, 150, 25);
	add(TextStraberry);
	
	TextRaisin=new JLabel("Uvas Pasas:");
	TextRaisin.setBounds(50, 330, 150, 25);
	add(TextRaisin);
	
	/****************************JTextArea*************************************/
	AreaNameInsumo = new JTextArea();
	AreaNameInsumo.setBounds(200, 50, 150, 20);
	AreaNameInsumo.setEnabled(false);
	add(AreaNameInsumo);

	AreaCodInsumo = new JTextArea();
	AreaCodInsumo.setBounds(200, 15, 150, 20);
	add(AreaCodInsumo);

	
	/*******************************************************/


	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	setBounds((screenSize.width-664)/2, (screenSize.height-456)/2, 670, 310);
}



public void actionPerformed(ActionEvent e)
{
	
	if(e.getSource()==Modify)
	{
		save.setVisible(true);
		RButtonMilk.setEnabled(true);
		RButtonColoring.setEnabled(true);
		RButtonEgg.setEnabled(true);
		RButtonFlour.setEnabled(true);
		RButtonRaisin.setEnabled(true);
		RButtonSabor.setEnabled(true);
		RButtonSugar.setEnabled(true);
		RButtonStraberry.setEnabled(true);
		AreaNameInsumo.setEnabled(true);
	}
	if(e.getSource()==save)
	{

	}
	if(e.getSource()==search)
	{
		Modify.setVisible(true);
	}
	if(e.getSource()==RButtonColoring)
	{
		JSPColoring.setEnabled(true);	
	}
	if(e.getSource()==RButtonEgg)
	{
		JSPEgg.setEnabled(true);	
	}
	if(e.getSource()==RButtonFlour)
	{
	JSPFlour.setEnabled(true);	
	}
	if(e.getSource()==RButtonMilk)
	{
	JSPMilk.setEnabled(true);	
	}
	if(e.getSource()==RButtonRaisin)
	{
	JSPRaisin.setEnabled(true);	
	}
	if(e.getSource()==RButtonSabor)
	{
	JSPSabor.setEnabled(true);	
	}
	if(e.getSource()==RButtonStraberry)
	{
	JSPstraberry.setEnabled(true);	
	}
	if(e.getSource()==RButtonSugar)
	{
	JSPSugar.setEnabled(true);	
	}

}
	
	
	
}
